package com.zmj.sy.mom.srv.aps.controller;


import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.stationweekday.*;
import com.zmj.sy.mom.srv.aps.service.StationWeekdaySchemeService;
import com.zmj.sy.mom.srv.aps.service.StationWeekdayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "工位-日历 关联")
@RestController
@RequestMapping("/stationWeekday")
public class StationWeekdayController {

    private final StationWeekdaySchemeService stationWeekdaySchemeService;

    private final StationWeekdayService stationWeekdayService;

    @ApiOperation("1.8.1 添加并发布")
    @PostMapping("/pubScheme")
    public BaseResVo add(@RequestBody StationWeekdayPubReqVo reqVo) {
        Integer id = stationWeekdaySchemeService.add(reqVo);

        // 自动发布
//        stationWeekdaySchemeService.pub(id);

        return BaseResVo.ok("添加成功");
    }


    @ApiOperation("1.8.2 查看工位日历列表")
    @GetMapping("/list")
    public BaseListResVo<StationWeekdayListResVo> add(StationWeekdayListReqVo reqVo) {
        return stationWeekdayService.list(reqVo);
    }

    @ApiOperation("1.8.3 查看工位的日历规则")
    @GetMapping("/get")
    public StationWeekdayGetResVo get(BaseIdReqVo reqVo) {
        return stationWeekdaySchemeService.get(reqVo);
    }

    @ApiOperation("1.8.4 根据工位ID和获取某个时间段的上下班时间")
    @GetMapping("/timeRange")
    public BaseListResVo<StationWeekdayTimeRangeResVo> timeRange(StationWeekdayTimeRangeReqVo reqVo){
        return stationWeekdayService.timeRange(reqVo);
    }

    @ApiOperation("1.8.3 查看工位的日历规则")
    @GetMapping("/stationGet")
    public StationWeekdayGetResVo stationGet(BaseIdReqVo reqVo) {
        return stationWeekdaySchemeService.stationGet(reqVo);
    }

    @ApiOperation("1.8.4 根据工位ID和获取某个时间段的上下班时间")
    @GetMapping("/stationTimeRange")
    public BaseListResVo<StationWeekdayTimeRangeResVo> stationTimeRange(StationWeekdayTimeRangeReqVo reqVo){
        return stationWeekdayService.stationTimeRange(reqVo);
    }


}
